CC=gcc

target=libpbd.so libpbd.a samples
layers_obj=pbd_build_layer2.o pbd_build_layer2p5.o
objects=libpbd.o pbd_linux.o pbd_pblock.o pbd_error.o $(layers_obj)
headers=pbd_type.h libpbd_data.h

all: $(targets)

libpbd.so:	$(objects)
	$(CC)	-shared -fPIC -o libpbd.so $(objects)

libpbd.a:	$(objects)
	ar r libpbd.a $(objects)

libpbd.o:	$(headers) libpbd.h pbd_pblock.o $(layers_obj)

$(layers_obj):	$(headers) pbd_linux.o pbd_pblock.o pbd_error.o

pbd_linux.o:	pbd_type.h  pbd_linux.h pbd_error.o

pbd_pblock.o:	pbd_type.h pbd_pblock.h pbd_error.o

pbd_error.o:	pbd_error.h pbd_error.c

samples:	main.c
	$(CC) -g -o samples main.c ./libpbd.so

.PHONY: clean
clean:
	-rm -rf $(target) $(objects)
